"use strict";

require('adapter-min.js');
__globalAdapter.init();
require('cocos/cocos2d-js-min.js');
__globalAdapter.adaptEngine();
require('./ccRequire');
require('./src/settings');
// Introduce Cocos Service here
require('./main'); // TODO: move to common

// Adjust devicePixelRatio
cc.view._maxPixelRatio = 4;
if (cc.sys.platform !== cc.sys.BYTEDANCE_GAME_SUB) {
  // Release Image objects after uploaded gl texture
  cc.macro.CLEANUP_IMAGE_CACHE = true;
}

window.boot();
/**抖音平台 */
const tt = window["tt"];
if (tt) {
    tt.onShow((res) => {
        window["isFromeSidebar"] = (res.launch_from == 'homepage' && res.location == 'sidebar_card')
        console.log("是否从侧边栏：", isFromeSidebar);
        console.log("启动参数：", res.query);
        console.log("来源信息：", res.refererInfo);
        console.log("场景值：", res.scene);
        console.log("启动场景字段：", res.launch_from, ", ", res.location);
    });

    tt.checkScene({
        scene: "sidebar",
        success: (res) => {
            console.log("check scene success: ", res.isExist);
            //成功回调逻辑
            window["supportSidebar"] = res.isExist;
        },
        fail: (res) => {
            console.log("check scene fail:", res);
            //失败回调逻辑
        }
    });
}